package com.bupt.order.controller;

import com.bupt.order.client.OrderClient;
import com.bupt.order.dto.OrderDto;
import com.bupt.order.entity.Order;
import com.bupt.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class OrderController implements OrderClient {

    @Autowired
    private OrderService orderService;

    @Override
    public List<Order> getAllOrders() {
        return orderService.getAllOrders();
    }

    @Override
    public List<Order> getOrdersByUserId(String userId) {
        return orderService.getOrdersByUserId(userId);
    }

    @Override
    public List<Order> getOrdersByModel(Order order) {
        return orderService.getOrdersByModel(order);
    }

    @Override
    public Map<String, Object> getOrdersCountByModel(Order order) {
        return orderService.getOrdersCountByModel(order);
    }

    @Override
    public Map<String, Object> getTicketsSoldNumByModel(Order order) {
        return orderService.getTicketsSoldNumByModel(order);
    }

    @Override
    public void createOrder(OrderDto orderDto) {
        orderService.createOrder(orderDto);
    }

    @Override
    public String getUserSessionTest() {
        return orderService.getUserSessionTest();
    }
}
